package week7;
import java.util.*;
public class pta06queue {
	//package test;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in );
		int n=sc.nextInt();
		//String s= sc.next();
		
		Queue<Integer> q1= new LinkedList<Integer>();
		Queue<Integer> q2= new LinkedList<Integer>();
		for(int i=0;i<n;i++){
			int x= sc.nextInt();
			if(x%2==0)
				q1.offer(x);
			else 
				q2.offer(x);
		}
		boolean f=false;
		
		while(!q1.isEmpty()||!q2.isEmpty()) {
			if(!q2.isEmpty()) {
				if(!f) {
					f=true;
					System.out.print(q2.poll());
				}
				else System.out.print(" "+q2.poll());
				
				//q1.poll();
				if(!q2.isEmpty()) {
					System.out.print(" "+q2.poll());
				}
			}
			
			if(!q1.isEmpty()) {
				if(!f) {
					f=true;
					System.out.print(q1.poll());
				}
				else System.out.print(" "+q1.poll());
			}
			
			
			
			
			
			
			
		}
		
		}
		}
	


